{% extends "base.html" %}
{# Page d'inscription #}

{% block title %}{{ pageTitle}}{% endblock %}

{% block content %}

{#%include 'displayErrors.html' %#}

{% if errors.csrf %}
	<div class="error">
		{{errors.csrf}}
	</div>
{%endif%}

<form class="formulaire" action="" method="post">
	{{crsfToken|raw}}
	
	{% if not edit %}
	<div class="absoluteLabel"> 
		<label for="id_nickname">Nickname</label> 
		<input id="id_nickname" type="text" name="nickname" maxlength="30" value="{{valueNickname}}" /> 
		<div class="formHelp"> 
			Your username here, used for login and ranking
		</div> 
		{% if errors.nickname %}<div class="fieldError">
			{{errors.nickname}}
		</div>{%endif%}
	</div> 
	{%else%}
		{{valueNickname}}
	{%endif%}
	
	<div class="absoluteLabel">
		<label for="id_password">{% if edit %}Actual password (only if you want to change){%else%}Password{%endif%}</label> 
		<input id="id_password" type="password" name="password" maxlength="30" value="{{valuePassword}}" />
		{% if errors.password %}<div class="fieldError">
			{{errors.password}}
		</div>{%endif%}
	</div> 
	
	<div class="absoluteLabel"> 
		<label for="id_password2">{% if edit %}New password (only if you want to change){%else%}Password again{%endif%}</label> 
		<input id="id_password2" type="password" name="password2" maxlength="30" value="{{valuePassword2}}" />
		<div class="formHelp"> 
			{% if not edit %}Put the same password a second time to be sure you typed it right{%endif%}
		</div> 
		{% if errors.password2 %}<div class="fieldError">
			{{errors.password2}}
		</div>{%endif%}
	</div> 

	<div class="{% if not edit %}absoluteLabel{% endif %}"> 
		<label for="id_email">Personnal email</label> 
		<input id="id_email" type="text" name="email" maxlength="70" value="{{valueEmail}}" /> 
		<div class="formHelp"> 
			Email used to confirm your registration, not visible to members
		</div> 
		{% if errors.email %}<div class="fieldError">
			{{errors.email}}
		</div>{%endif%}
	</div> 

	<div class="{% if not edit %}absoluteLabel{% endif %}"> 
		<label for="id_email2">Public email</label> 
		<input id="id_email2" type="text" name="displayed_email" maxlength="70" value="{{valueDisplayed_email}}" /> 
		<div class="formHelp"> 
			Email visible in your profile
		</div> 
		{% if errors.displayed_email %}<div class="fieldError">
			{{errors.displayed_email}}
		</div>{%endif%}
	</div> 

	<div class="{% if not edit %}absoluteLabel{% endif %}"> 
		<label for="id_birthdate">Birthdate (DD/MM/YYYY)</label> 
		<input id="id_birthdate" type="text" name="birthdate" maxlength="30" value="{{valueBirthdate}}" /> 
		<div class="formHelp"> 
			Your date of birth, used to calculate your age. Example: 31/12/1992.
		</div> 
		{% if errors.birthdate %}<div class="fieldError">
			{{errors.birthdate}}
		</div>{%endif%}
	</div> 

	<div class=""> 
		<label for="id_country">Country</label> 
		<select id="id_country" name="country" maxlength="30" >
		{% for country in countries %}
			<option value="{{country.id}}" {% if country.name == valueCountry or country.id == valueCountry %}selected="selected"{% endif %}>{{country.name}}</option>
		{% endfor %}
		</select>
		{% if errors.country %}<div class="fieldError">
			{{errors.country}}
		</div>{%endif%}
	</div> 

	<div class="{% if not edit %}absoluteLabel{% endif %}"> 
		<label for="id_description">Description</label> 
		<textarea id="id_description" name="description" >{{valueDescription}}</textarea>		
		<div class="formHelp"> 
			Introduce yourself, this will appear in your profile
		</div>
		{% if errors.description %}<div class="fieldError">
			{{errors.description}}
		</div>{%endif%}
	</div> 
	
	<input type="submit" name="submit" value="{% if edit %}Submit{%else%}Register{%endif%}" /> 
    </form> 
 
{% endblock content %}